<?php
class Test {
function getTest_ByID($id) {
	global $db;
	if (empty($id)) {
		return false;
	}
	$sql = "select * from Test where ID=".$id;
	$result = $db->Execute($sql);
	$data = $result->FetchRow();
	return $data;
}

function listTest($order = "id") {
	global $db;
	if (empty($order)) {
		$order = "id";
	}
	$sql = "select * from Test order by ".$order." desc";
	$result = $db->Execute($sql);
	$rs = array();
	while ($data = $result->FetchRow()) {
		array_push($rs, $data);
	}
	return $rs;
}

/*
function setTest($id = "", $pairs, $work = "") {
	global $db;
	if (!$id) {
		$sql = " insert into Test";
		$sql .= "(" .join(array_keys($pairs),',') . ")";
		$sql .= " values";
		$sql .= "(". join(array_values($pairs),""".",".""")."")";
		
	}else {
		if ($work == "update") {
		$sql = "$work Test";
		array_walk($pairs, create_function("&$value,&$name","$value = $name . "="" ."$value". """; ") );
		$sql .= " set " . join(array_values($pairs),",");
		$sql .= " where id=$id";
	}elseif ($work == "delete") {
		$sql = "$work from Test where ID="$id"";
	}
	$result = $db->Execute($sql);
	return $result;
}
*/

}
?>
